﻿//-----------------------------------------------------------------------
// <copyright file="AddressRepository.cs" company="FastNET Services">
//     Copyright (c) 2007-2011. All Rights Reserved.
// </copyright>
// <warranty>
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//     BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//     DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </warranty>
//-----------------------------------------------------------------------

#region Usings
using System;
using System.Data.EntityClient;
using FastNet.RepositorySystem;
using SampleRepository.Entities;
using SampleRepository.Repositories;
using SampleStore.Entities;
#endregion

namespace SampleStore.Repositories
{

    /// <summary>
    /// Repository Class for handling IAddressData
    /// </summary>
    internal class AddressRepository : IdentityRepositoryBase<IAddressData, Address, Guid>, IAddressRepository
    {
        #region CTor/DTor

        /// <summary>
        /// Initializes a new instance of the AddressRepository class
        /// </summary>
        /// <param name="connection">EntityConnection used for connecting to the database</param>
        public AddressRepository(EntityConnection connection)
            : base(connection)
        {
        }

        #endregion

        #region Overrides of RepositoryBase<IAddressData,Address>

        /// <summary>
        /// Gets the entity set name for the type of object being managed
        /// </summary>
        /// <returns>String representing the Entity Set name</returns>
        protected override string EntitySetName
        {
            get { return "EntitiesContainer.Addresses"; }
        }

        /// <summary>
        /// Requests the specified object to be modified for a saved deletion status
        /// </summary>
        /// <param name="item">Item to modify</param>
        protected override void MarkObjectDeleted(Address item)
        {
            item.DateDeleted = DateTime.UtcNow;
        }

        /// <summary>
        /// Handles merging special configuration changes before saving the entity
        /// </summary>
        /// <param name="entity">Entity to make changes to</param>
        protected override void HandleChanges(Address entity)
        {
        }

        #endregion

        #region MergeChanges


        #endregion

        #region Implementation of IAddressRepository


        #endregion
    }
}
